home *** CD-ROM | disk | FTP | other *** search
/ SPACE 2 / SPACE - Library 2 - Volume 1.iso / music / 188 / pascal / auxsubs.pas next >
Pascal/Delphi Source File  |  1987-10-14  |  8KB  |  320 lines

  1. {**************************************************************************
  2. *
  3. *    AUXSUBS.PAS - Declarations for PASAUX library
  4. *
  5. ***************************************************************************}
  6.  
  7. { Constants used by the auxilliary library }
  8.  
  9. CONST
  10.     SCRLEN_B = 32000 ; { size of ST screen in bytes }
  11.     SCRLEN_W = 16000 ; { size of ST screen in words }
  12.     SCRLEN_L = 8000  ; { size of ST screen in long words }
  13.  
  14.     { the various error codes }
  15.  
  16.     NO_ERROR = 0;
  17.     SYS_ERROR = -1;
  18.     DRIVE_ERROR = -2;
  19.     UNKNOWN_ERROR = -3;
  20.     CRC_ERROR = -4;
  21.     BAD_REQUEST = -5;
  22.     SEEK_ERROR = -6;
  23.     UNKNOWN_MEDIA = -7;
  24.     SECTOR_NOT_FOUND = -8;
  25.     NO_PAPER = -9;
  26.     WRITE_FAULT = -10;
  27.     READ_FAULT = -11;
  28.     GENERAL_ERROR = -12;
  29.     WRITE_PROTECT = -13;
  30.     MEDIA_CHANGE = -14;
  31.     UNKNOWN_DEVICE = -15;
  32.     BAD_SECTOR = -16;
  33.     DISK_CHANGE = -17;
  34.     INVALID_FUNCTION = -32;
  35.     FILE_NOT_FOUND = -33;
  36.     PATH_NOT_FOUND = -34;
  37.     TOO_MANY_FILES = -35;
  38.     ACCESS_DENIED = -36;
  39.     INSUFFICIENT_MEM = -39;
  40.     INVALID_MEM_ADDR = -40;
  41.     INVALID_DRIVE = -46;
  42.  
  43. { end of constants used by AUXPAS }
  44.  
  45. TYPE
  46.  
  47. { types used by AUXPAS }
  48.  
  49.     C_String =  PACKED ARRAY [ 0..255 ] OF CHAR ;  { c-style string }
  50.  
  51.     Err_Code = Short_Integer ;            { tos error code }
  52.  
  53.     { the ST screen in 3 representations }
  54.     Screen_B = PACKED ARRAY [ 0..31999 ] OF BYTE ;
  55.     Screen_I = PACKED ARRAY [ 0..15999 ] OF Short_Integer ;
  56.     Screen_L = PACKED ARRAY [ 0..7999 ]  OF Long_Integer ;
  57.  
  58.     B_Ptr = ^BYTE ;
  59.     C_Ptr = ^CHAR ;
  60.     I_Ptr = ^Short_Integer ;
  61.     L_Ptr = ^Long_Integer ;
  62.  
  63.     Ptr_Screen = ^Screen_L    ;   { pointer to the screen array }
  64.     Palette = PACKED ARRAY [ 0..15 ] OF Short_Integer ;
  65.     Resolution = Short_Integer ;
  66.  
  67.     Screen_Type = PACKED RECORD
  68.         Res : Resolution ;
  69.         Pal : Palette ;
  70.         Pic : Screen_L ;
  71.         END ;
  72.  
  73. { end of type used by PASAUX }
  74.  
  75. { now the various external and other declarations }
  76.  
  77. {*************************************************************************
  78. *
  79. *    Peek/poke routines
  80. *
  81. *************************************************************************}
  82.  
  83. FUNCTION Peek( Address : Long_Integer )
  84.     : BYTE ;
  85.     EXTERNAL;
  86. FUNCTION Wpeek( Address : Long_Integer )
  87.     : Short_Integer ;
  88.     EXTERNAL;
  89. FUNCTION Lpeek( Address : Long_Integer )
  90.     : Long_Integer ;
  91.     EXTERNAL;
  92.  
  93. PROCEDURE Poke( Address: Long_Integer ;
  94.         Value  : BYTE ) ;
  95.     EXTERNAL;
  96. PROCEDURE Wpoke( Address: Long_Integer ;
  97.          Value  : Short_Integer ) ;
  98.     EXTERNAL;
  99. PROCEDURE Lpoke( Address: Long_Integer ;
  100.          Value: Long_Integer );
  101.     EXTERNAL;
  102.  
  103. {*************************************************************************
  104. *
  105. *    Supervisor status goodies.
  106. *
  107. *************************************************************************}
  108.  
  109. FUNCTION In_Super
  110.     : Boolean;
  111.     EXTERNAL;
  112. PROCEDURE Super( YesNo : Boolean ); 
  113.     EXTERNAL;
  114.  
  115.  
  116. {*************************************************************************
  117. *
  118. *    Block memory move routines
  119. *
  120. *************************************************************************}
  121.  
  122. PROCEDURE Move_Long( Source, Dest, Count : Long_Integer );
  123.     EXTERNAL;
  124. PROCEDURE Move_Word( Source, Dest, Count : Long_Integer );
  125.     EXTERNAL;
  126. PROCEDURE Move_Byte( Source, Dest, Count : Long_Integer );
  127.     EXTERNAL;
  128.  
  129. {*************************************************************************
  130. *
  131. *    Pascal to C routine interface routines
  132. *
  133. *************************************************************************}
  134.  
  135. PROCEDURE C_to_Pstr( Cstr : C_String ;
  136.            VAR Pstr : STRING );
  137.     EXTERNAL;
  138. PROCEDURE P_to_Cstr( Pstr : STRING ;
  139.            VAR Cstr : C_String );
  140.     EXTERNAL;
  141.  
  142. {*************************************************************************
  143. *
  144. *    date stuff
  145. *
  146. *************************************************************************}
  147.  
  148. PROCEDURE Set_Date( Mon, Day, Yr : Short_Integer );
  149.     EXTERNAL;
  150. PROCEDURE Set_Time( Hour, Min, Sec : Short_Integer );
  151.     EXTERNAL;
  152. PROCEDURE Get_Date( VAR Mon, Day, Yr : Short_Integer );
  153.     EXTERNAL;
  154. PROCEDURE Get_Time( VAR Hour, Min, Sec : Short_Integer );
  155.     EXTERNAL;
  156.  
  157. {*************************************************************************
  158. *
  159. *    Screen functions
  160. *
  161. *************************************************************************}
  162.  
  163.  
  164. PROCEDURE Save_Scrn( VAR  Buf : Screen_Type );
  165.     EXTERNAL;
  166. PROCEDURE Restr_Scrn( VAR  Buf : Screen_Type );
  167.     EXTERNAL;
  168.  
  169. FUNCTION Read_Scrn( Name : String ;
  170.             VAR  Buf : Screen_Type )
  171.     : Err_Code ;
  172.     EXTERNAL;
  173. FUNCTION Write_Scrn( Name : String ;
  174.              VAR  Buf : Screen_Type )
  175.     : Err_Code;
  176.     EXTERNAL;
  177.  
  178. {*************************************************************************
  179. *
  180. *    Ptr/Adr routines
  181. *
  182. *************************************************************************}
  183.  
  184.  
  185. FUNCTION Ptr_Byte( Addr : Long_Integer )
  186.     : B_Ptr ;
  187.     EXTERNAL ;
  188. FUNCTION Ptr_Char( Addr : Long_Integer )
  189.     : C_Ptr;
  190.     EXTERNAL;
  191. FUNCTION Ptr_Integer( Addr : Long_Integer )
  192.     : I_Ptr;
  193.     EXTERNAL;
  194. FUNCTION Ptr_Long_Integer( Addr : Long_Integer )
  195.     : L_Ptr;
  196.     EXTERNAL;
  197.  
  198. FUNCTION Addr_Byte( VAR Bvar : BYTE )
  199.     : Long_Integer;
  200.     EXTERNAL;
  201. FUNCTION Addr_Char( VAR Cvar : CHAR )
  202.     : Long_Integer;
  203.     EXTERNAL;
  204. FUNCTION Addr_Integer( VAR Ivar : Short_Integer )
  205.     : Long_Integer;
  206.     EXTERNAL;
  207. FUNCTION Addr_Long_Integer( VAR Lvar : Long_Integer )
  208.     : Long_Integer;
  209.     EXTERNAL;
  210.  
  211. FUNCTION IO_State
  212.     : Boolean ;
  213.     EXTERNAL ;
  214. FUNCTION IO_Result
  215.     : Short_Integer ;
  216.     EXTERNAL ;
  217. PROCEDURE IO_Check( YesNo : Boolean ) ;
  218.     EXTERNAL ;
  219.  
  220. {*************************************************************************
  221. *
  222. *    vt52 functions - use with write,writeln in non-gem programs
  223. *
  224. **************************************************************************}
  225.  
  226.  
  227. { Clear from the cursor to the end of the current line }
  228. PROCEDURE ClrEol;
  229.     EXTERNAL;
  230.  
  231. { Clear the screen and move the cursor to the upper left position }
  232. (* This is Turbo-Pascal compatible: *)
  233. PROCEDURE ClrScr;
  234.     EXTERNAL;
  235. (* But the manual incorrectly gives this: *)
  236. PROCEDURE ClrScrn; EXTERNAL;
  237. (* Either one will work since it's in the library both ways! *)
  238.  
  239. { Initialize the console device }
  240. PROCEDURE CrtInit;
  241.     EXTERNAL;
  242.  
  243. { Reset the console device }
  244. PROCEDURE CrtExit;
  245.     EXTERNAL;
  246.  
  247. { Delete the current line, moving all lines below up by one line }
  248. PROCEDURE DelLine;
  249.     EXTERNAL;
  250.  
  251. { Insert a blank line at the current position, moving the current line and
  252.   all lines below down by one line.  The bottom line on the screen is lost }
  253. PROCEDURE InsLine;
  254.     EXTERNAL;
  255.  
  256. { Move to a specific screen coordinate.  Home is (1,1). }
  257. PROCEDURE GotoXY( x, y : Short_Integer );
  258.     EXTERNAL;
  259.  
  260. { Reverse foreground and background colors for text display }
  261. PROCEDURE InverseVideo;
  262.     EXTERNAL;
  263.  
  264. { Restore normal colors }
  265. PROCEDURE NormVideo;
  266.     EXTERNAL;
  267.  
  268. { Choose a foreground color index for text display }
  269. PROCEDURE TextColor( color : Short_Integer );
  270.     EXTERNAL;
  271.  
  272. { Choose a background color index for text display }
  273. PROCEDURE TextBackground( color : Short_Integer );
  274.     EXTERNAL;
  275.  
  276. { ---------------------------------------------------------------------------
  277.   The following procedures and functions are not in the Turbo Pascal library:
  278.   --------------------------------------------------------------------------- }
  279.  
  280. { Move the cursor up one line }
  281. PROCEDURE Curs_Up;
  282.     EXTERNAL;
  283.  
  284. { Move the cursor down one line }
  285. PROCEDURE Curs_Down;
  286.     EXTERNAL;
  287.  
  288. { Move the cursor right one column }
  289. PROCEDURE Curs_Right;
  290.     EXTERNAL;
  291.  
  292. { Move the cursor left one column }
  293. PROCEDURE Curs_Left;
  294.     EXTERNAL;
  295.  
  296. { Move the cursor to the upper left corner of the screen }
  297. PROCEDURE Curs_Home;
  298.     EXTERNAL;
  299.  
  300. { Same as CursUp, but inserts a blank line at the top of the screen }
  301. PROCEDURE Curs_Up_2;
  302.     EXTERNAL;
  303.  
  304. { Clear from cursor to end of the screen }
  305. (* This matches ClrScr: *)
  306. PROCEDURE ClrEos;
  307.     EXTERNAL;
  308. (* The manual disagrees-- In the library it's both ways! *)
  309. PROCEDURE Clr_Eos; EXTERNAL;
  310.  
  311. { Turn on the flashing cursor }
  312. PROCEDURE Curs_On;
  313.     EXTERNAL;
  314.  
  315. { Turn off the flashing cursor (i.e., no cursor is displayed) }
  316. PROCEDURE Curs_Off;
  317.     EXTERNAL;
  318.  
  319. { end of AUXSUBS.PAS }
  320.